package com.challenge.smsdao.teachermanage.domain;

import com.fasterxml.jackson.annotation.JsonIgnoreProperties;
import com.challenge.smsbase.Domain.BaseEntity;

import javax.persistence.*;
import java.util.List;

/**
 * maboqi
 */
@Entity
public class Department extends BaseEntity<Long> {
    @Column
    private String name;
    @JsonIgnoreProperties("department")
    @OneToMany(mappedBy = "department",cascade = {CascadeType.REMOVE,CascadeType.REFRESH},fetch = FetchType.LAZY)
    private List<Teacher> teachers;

    public String getName() {
        return name;
    }

    public void setName(String name) {
        this.name = name;
    }

    public List<Teacher> getTeachers() {
        return teachers;
    }

    public void setTeachers(List<Teacher> teachers) {
        this.teachers = teachers;
    }

    @Override
    public String toString() {
        return "Department{" +
                "name='" + name + '\'' +
                '}';
    }
}
